package com.hdsx.restful.glzt.roadline.dmdx.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.esri.arcgis.geometry.IGeometry;
import com.hdsx.ao.base.BaseOpearte;
import com.hdsx.ao.util.GemotryUtil;
import com.hdsx.restful.glzt.roadline.dmdx.bean.Dmdx;
import com.hdsx.restful.glzt.roadline.dmdx.mapper.DmdxMapper;
import com.hdsx.restful.glzt.roadline.dmdx.service.DmdxService;

@Service
public class DmdxServiceImpl extends BaseOpearte<Dmdx> implements DmdxService {
	public DmdxServiceImpl() {
		super("GIS_DMDX");
	}

	@Resource
	private DmdxMapper dmdxMapper;

	@Override
	public int queryCountByParameter(String lxdm) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("lxdm", lxdm);
		return dmdxMapper.queryCountByParameter(map);
	}

	@Override
	public List<Dmdx> queryByParameter(String lxdm, int begin, int end) {

		Map<String, Object> parameter = new HashMap<String, Object>();
		parameter.put("begin", begin);
		parameter.put("end", end);
		parameter.put("lxdm", lxdm);
		List<Dmdx> lists=dmdxMapper.queryByParameter(parameter);
		for(Dmdx dmdx:lists){
			dmdx.setShape(selectShape("ID= '"+dmdx.getId()+"'"));
		}
		return lists;
	}

	@Override
	public String queryDmdxString(String id) {
		IGeometry shape=selectShape("ID= '"+id+"'");
		return GemotryUtil.generateLineString(shape);
	}

}
